
<!--
  User: Kuttubek Aidaraliev
  Date: 06.05.2010
  Time: 16:08:24
-->

<rich:modalPanel xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:rich="http://richfaces.org/rich"
                 xmlns:a4j="http://richfaces.org/a4j"
                 id="panel" width="350" height="100" showWhenRendered="#{regionBean.newEntity}">
    <f:facet name="header">
        <h:panelGroup>
            <h:outputText value="#{messages.newRegion}"></h:outputText>
        </h:panelGroup>
    </f:facet>
    <f:facet name="controls">
        <h:panelGroup>
            <h:graphicImage value="/img/close.png" styleClass="hidelink" id="hidelink" onclick="executeAction('regionForm:regionCanceled');"/>
            <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
        </h:panelGroup>
    </f:facet>
    <h:panelGrid columns="2">

        <a4j:region>
            <a4j:form id="regionForm">
                <ui:decorate template="../common/edit.xhtml">
                    <ui:define name="label"><h:outputText value="#{messages.title}"/></ui:define>
                    <h:inputText id="newRegion" required="true"
                                 requiredMessage="#{messages.requiedMessage}"
                                 value="#{regionBean.entity.title}"/>
                    <ui:param name="required" value="true"/>
                    <ui:param name="idInput" value="newRegion"/>
                </ui:decorate>


                <h:panelGroup>
                    <a4j:commandButton action="#{regionBeanController.inserted}" value="#{messages.create}"
                                       reRender="region">
                    </a4j:commandButton>
                </h:panelGroup>
                <a4j:commandLink id="regionCanceled" action="#{regionBeanController.currentPage}" ajaxSingle="true">
                    <f:setPropertyActionListener value="false" target="#{regionBean.newEntity}" />
                </a4j:commandLink>
            </a4j:form>
        </a4j:region>
    </h:panelGrid>
</rich:modalPanel>